package org.korifey.ffbdd.samples.queens;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;

public class QueensBasic {
	
	static Set<Position> res;
	static int boardSize;
	
	public static Set<Position> solve(int n) {
		boardSize = n;
		res = new HashSet<Position>();
		inner(new Position(n));
		return res;
	}
	
	private static void inner(Position p) {
		if (p.getSize() == boardSize) {
			res.add(p);
		} else {
			for (int i=0; i<boardSize; i++) {
				Position n = p.add(i);
				if (n != null) inner(n);
			}
		}
	}
	
}
